<template>
	<view class="content">

		<uni-list>
			<!-- 	<uni-list-item
			v-for="item,index in list"
			 :key="index"
			 :title="item.name"
			 :note="item.department"
			 :thumb="item.icon"
			 :badgeText="item.badgeText"
			 thumbSize="lg" 
			 showBadge="true"
			  >
			  </uni-list-item>
			 -->
			<uni-list-item v-for="item,index in list" :key="index" :title="item.name" :note="item.department" clickable
				@click="tomessage(item.id)">
			</uni-list-item>

		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": [],
			}
		},
		methods: {
			tomessage(itemid) {

				uni.navigateTo({
					url: '../classmatedatail/classmatedatail?itemid=' + itemid
				});
			},
			
			getlistcf(){
				uniCloud.callFunction({
					name:'schoolcf',
					success: (res) => {
						console.log(res);
						this.list = res.result.data
					}
				})
			}
		},
		onLoad() {
			this.getlistcf()
			
			
			
			// uni.request({
			// 	url: 'http://localhost:8091/freshmenapp/user/list',
			// 	method: 'POST',
			// 	data: {},
			// 	success: res => {
			// 		// console.log(res.data);
			// 		if (res.data.success === true) {
			// 			this.list = res.data.list
			// 		}
			// 	},
			// 	fail: (err) => {
			// 		uni.showToast({
			// 			title: '网络错误',
			// 			icon: 'error'
			// 		});
			// 	},
			// 	complete: () => {}
			// });
		}
	}
</script>

<style>
	/deep/ .uni-badge {
		background-color: red;
	}
</style>